package com.oss.controller.oss;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.oss.common.BaseResponse;
import com.oss.dto.oss.DeleteByIdDto;
import com.oss.dto.oss.GetByIdDto;
import com.oss.dto.oss.capitalmanage.CapitalManageAddDto;
import com.oss.dto.oss.capitalmanage.CapitalManageImportDto;
import com.oss.dto.oss.capitalmanage.CapitalManagePageDto;
import com.oss.dto.oss.capitalmanage.CapitalManageUpdateDto;
import com.oss.dto.oss.capitalsummary.PageDto;
import com.oss.dto.oss.rechargeManage.AddDto;
import com.oss.dto.oss.rechargeManage.UpdateDto;
import com.oss.dto.oss.trademanage.TradeManageGetByIDDto;
import com.oss.entity.oss.CapitalManage;
import com.oss.entity.oss.RechargeManage;
import com.oss.service.oss.CapitalManageService;
import com.oss.service.oss.RechargeManageService;
import com.oss.vo.oss.capital.CapitalManageVO;
import com.oss.vo.oss.rechargeManage.RechargeManageVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 充值管理
 */
@RestController
@RequestMapping("/rechargeManage")
public class RechargeManageController {
    @Autowired
    RechargeManageService rechargeManageService;

    @PostMapping("/selectByPage")
    public BaseResponse<IPage<RechargeManageVO>> selectByPage(@RequestBody @Valid PageDto dto){
        return BaseResponse.success(rechargeManageService.selectByPage(dto));
    }
    @PostMapping("/getByID")
    public BaseResponse<RechargeManage> getByID(@RequestBody @Valid GetByIdDto dto){
        return BaseResponse.success(rechargeManageService.getById(dto.getId()));
    }
    @PostMapping("/add")
    public BaseResponse<String> add(@RequestBody @Valid AddDto dto){
        return BaseResponse.success(rechargeManageService.add(dto));
    }
    @PostMapping("/update")
    public BaseResponse<String> updateData(@RequestBody @Valid UpdateDto dto){
        return BaseResponse.success(rechargeManageService.updateData(dto));
    }
    @PostMapping("/delete")
    public BaseResponse<String> delete(@RequestBody @Valid DeleteByIdDto dto){
        return BaseResponse.success(rechargeManageService.delete(dto));
    }
}